package com.moli.iov.down.command.design.strategy.commandreqdto.impl;

import com.moli.iov.down.enums.command.CommandEnum;
import com.moli.iov.down.enums.OperateTypeEnum;
import com.moli.iov.down.enums.command.RemoteControlEnum;
import com.moli.iov.down.enums.command.extend.ExtendPowerEnum;
import com.moli.iov.down.model.dto.remoting.CommandDto;
import com.moli.iov.down.model.dto.remoting.CommandReqDto;
import com.moli.iov.down.command.design.strategy.commandreqdto.CommandReqDtoStrategy;

/**
 * <p>
 *  开启动力、关闭动力
 * </p>
 *
 * @author: zql
 * @Date: 2018/12/28 11:54
 */
public class PowerStrategy implements CommandReqDtoStrategy {

    @Override
    public CommandDto make(CommandReqDto commandReqDto) {
        CommandDto commandDto = new CommandDto();
        commandDto.setVin(commandReqDto.getVin());
        commandDto.setIsRetry(commandReqDto.getIsRetry());

        //开启动力、关闭动力
        commandDto.setCommand(CommandEnum.REMOTE_CONTROL.getFlag());
        commandDto.setControlCommand(RemoteControlEnum.POWER_CONTROL.getFlag());
        commandDto.setControlContent(commandReqDto.getOperateType() == OperateTypeEnum.OPEN_POWER.getFlag() ?
                ExtendPowerEnum.ENABLE.getFlag() : ExtendPowerEnum.DISABLED.getFlag());
        return commandDto;
    }
}
